package indiwood.model.dao;

import indiwood.model.MagazineVO;

import java.util.List;

import javax.annotation.Resource;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class MagazineDAOImpl implements MagazineDAO {
	@Resource(name = "sqlSessionTemplate")
	private SqlSessionTemplate sqlSessionTemplate;
	@Override
	public void write(MagazineVO mvo) {
		sqlSessionTemplate.insert("magazine.write", mvo);
	}
	@Override
	public MagazineVO showContent(int no) {
		return sqlSessionTemplate.selectOne("magazine.showContent", no);
	}
	@Override
	public void updateCount(int no) {
		sqlSessionTemplate.update("magazine.updateCount", no);
	}
	@Override
	public List<MagazineVO> magazineList(String pageNo) {
		return sqlSessionTemplate.selectList("magazine.magazineList", pageNo);
	}
	@Override
	public int totalContent() {
		return sqlSessionTemplate.selectOne("magazine.totalContent");
	}
	@Override
	public void updateBoard(MagazineVO mvo) {
		sqlSessionTemplate.update("magazine.updateBoard", mvo);
	}
	@Override
	public void deleteBoard(String no) {
		sqlSessionTemplate.delete("magazine.deleteBoard", no);
	}
}
